package routes

import (
	v1 "ReaderInOutLog/api/v1"
	"ReaderInOutLog/middleware"
	"ReaderInOutLog/util"

	"github.com/gin-gonic/gin"
)

func InitRouter() {
	gin.SetMode(util.AppMode)
	r := gin.New()
	r.Use(gin.Recovery())
	r.Use(middleware.Logger())
	r.Use(middleware.Cors())

	// auth := r.Group("api/v1")
	// auth.Use(middleware.JwtToken())
	// {
	// 	// 添加
	// 	auth.POST("readerInOutLog/add", v1.AddRecode)

	// }
	routeV1 := r.Group("api/v1")
	{
		// 获取单个文章
		routeV1.GET("readerInOutLog/info/:id", v1.GetReaderInOutLogInfo)
		//查询所有文章信息
		routeV1.POST("readerInOutLogByTime", v1.GetReaderInOutLogByTime)
		routeV1.POST("readerInOutLogList", v1.GetReaderInOutLogAll)
		routeV1.POST("readerInOutLog/add", v1.AddRecode)
	}
	r.Run(util.HttpPort)
}
